<?php session_start();
//Check if logged in. if not, send to login.
if(!isset($_SESSION['loggedIn'])){
	header('Location: StudentLogin.php');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="main.css" rel="stylesheet" type="text/css" />
</head>
<body>
&nbsp;
<p>&nbsp; &nbsp;</p>
&nbsp;
	<div id="navigation"><ul>
    <li><a href="logout.php">Logout</a></li>
    <li><a href="ChangePassword.php">Change Password</a></li>
    <li><a href="StudentAssignment.php">Student Assignments</a></li>
    <!--<li><a href="/main/index.php">Home</a></li>-->
</ul></div>
    <div id="wrapper">
      	<div id="section">
            <div id='sectionHeader'>Assignment</div>
        <!-- GROUP CONTENT -->
<?php 
//PHP to just list links to the files for downloading.
//This is to prevent folder browsing.
$path = "../data/Classes/" . $_SESSION['class'] . "/Students/" . $_SESSION['student'] . "/";;
$dir_handle = @opendir($path) or die("Unable to open $path");
while ($file = readdir($dir_handle)) {
	if($file == "." || $file == ".." || $file == "index.php" || $file == "redirect.php")
	continue;
	echo "<a href=\"$path$file\">$file</a><br />";
}
closedir($dir_handle);
?>
<a href="StudentAssignment.php">Previous</a>
		<!-- END GROUP CONTENT -->
        </div>
    </div>
</body>
</html>